﻿using KinonekoSoftware.CodariaDB.Documents.Index;
using KinonekoSoftware.CodariaDB.Documents.TemplateContents;

namespace KinonekoSoftware.CodariaDB.Objects
{
    public abstract class TreeObject<T> : RootObject where T : RootObject
    {
        private T _object;

        public void Initialize(T content)
        {
            _object = content;
        }

        public string ParentID   { get; set; }
        public string DocumentID { get; set; }

        [BsonIgnore]
        public T Object
        {
            get => _object;
            set
            {
                _object    = value;
                DocumentID = _object?.Id;
            }
        }
    }

    public abstract class TreeObject<TCache, TContent> : TreeObject<TCache>
        where TCache : RootObject
        where TContent : TemplatedContent
    {

        [BsonIgnore]
        public TContent TemplatedContent { get; set; }
    }
}